//
//  CLVisitorViewTableViewController.swift
//  weibo001
//
//  Created by CL on 16/7/10.
//  Copyright © 2016年 CL. All rights reserved.
//

import UIKit

class CLVisitorViewTableViewController: UITableViewController {

    //是否登记标记
    var isLogin: Bool = false
    
    //访客视图
    var VisitorView: CLVistorView?
    
    
    override func loadView() {
        
        if isLogin {
            super.loadView()
        } else {
            VisitorView = CLVistorView()
            
            //使用self需要注意循环引用
            VisitorView?.loginClosure = { [weak self] in
                
                print("点击了 访客视图")
                
                
            }
            
            view = VisitorView
            setupUI()
            
        }
        
        
    }
    
    
   private func setupUI() {
        
        setupNavUI()
    }
    
    
   private func setupNavUI() {
        //设置自定义视图
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", target: self, action: "registerBtnAction")
         navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", target: self, action: "loginBtnAction")
        
    }
    
    
    override func viewDidLoad() {
        super.viewDidLoad()

    }

    
      //MARK   --点击事件
    @objc private  func registerBtnAction() {
        
        print("registerBtnAction")
    }


    @objc private  func loginBtnAction() {
        
        print("loginBtnAction")
    }
    

}
